<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>A2P</title>

<script src="../js/jquery.functions.js" type="text/javascript"></script>


<style type="text/css" title="currentStyle">
			@import "../tabla/demo_page.css";
			@import "../tabla/demo_table.css";
		</style>

		<script type="text/javascript" language="javascript" src="../tabla/jquery.dataTables.js"></script>
		<script type="text/javascript" charset="utf-8">
			$(document).ready(function() {
				$('#example').dataTable();
			} );
			
			function exportar(){
				document.getElementById('excel').src="exportarexcel.php"
			}
		</script>
</head>

<body id="dt_example">


    
    <div id="container" style="width:700px">


			<div id="demo">


	<table id="example" class="display">
    <thead>
   		<tr>
           	<th>Fecha</th>
        	<th>Movistar</th>
            <th>Claro</th>

           
        </tr>
        </thead>
        <tbody>
<?php
$link = mysql_connect("localhost", "admin", "Xurpas123");
mysql_select_db("smsnic",$link);

$result1= mysql_query("SELECT fecha, IFNULL( 
CASE WHEN t.`operadora_id` =2
THEN COUNT( * ) 
END , 0 ) AS Claro, IFNULL( 
CASE WHEN t.`operadora_id` =1
THEN COUNT( * ) 
END , 0 ) AS Movistar
FROM  `envios` e
INNER JOIN  `telefonos` t ON ( e.`id_telefono` = t.`id` ) 
where e.`estado`=1 and e.`fecha` BETWEEN '".$fecha_ini."' AND '".$fecha_fin."'
group by e.`fecha`", $link) or die(mysql_error());

if(mysql_num_rows($result1)) {
	while( $cliente = @mysql_fetch_array($result1) ){
	?>
	
		  <tr class="gradeA">
	         <td class="center"><?php echo $cliente['fecha'] ?></td>
   	         <td class="center"><?php echo $cliente['Movistar'] ?></td>
              <td class="center"><?php echo $cliente['Claro'] ?></td>



		  </tr>
	<?php
	}
}
?>
</tbody>
<tfoot>

   		<tr>
         <th>Fecha</th>
        	<th>Movistar</th>
            <th>Claro</th>


        </tr>

</tfoot>
</table>   
</div>
<table>
<tr>
<td align="center">


</td>
</tr>
</table>
			<div class="spacer"></div>
			
			
			
			</div>
            
		</div>
        
<iframe style="display:none" id="excel">
</iframe>
        
</body>

</html>



